{% extends 'index_base.html' %}

{% block title %}
测试2
{% endblock %}

{% block head %}

{% endblock %}

{% block main %}
<div class="layui-tab">
  <ul class="layui-tab-title">
    <li class="layui-this">车辆记录</li>
    <li>汽车管理</li>
    <li>电度表</li>
    <li>发票</li>
    <li>车辆保养记录</li>
  </ul>
  <div class="layui-tab-content">
    <!--start车辆记录显示表-->
    <div class="layui-tab-item layui-show">
        <!--左侧表格数据栏-->
        <div class="main_lift" style="width: 80%; float: left;">
<table class="layui-table" lay-size="sm">
  <colgroup>
    <col width="150">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
        <th>日期</th>
        <th>车牌号</th>
        <th>记录时间</th>
        <th>公里数</th>
        <th>较上日</th>
        <th>加油费用</th>
        <th>操作</th>
    </tr>
  </thead>
  <tbody>
        {% for record in records %}
            {% if record['data']|count==1 %}
              <tr data-id="{{ record['data'][0].id }}" data-time="{{ record['data'][0].记录时间 }}" data-day="{{ record['data'][0].record_day }}" data-carCode="{{ record['data'][0].car_code }}" data-kilom="{{ record['data'][0].公里数 }}" data-than="{{ record['data'][0].较上日 }}" data-oil="{{ record['data'][0].加油费用 }}">
                <td>{{ record['day'] }}</td>
                <td>{{ record['data'][0].car_code }}</td>
                <td>{{ record['data'][0].记录时间 }}</td>
                <td>{{ record['data'][0].公里数 }}</td>
                <td>{{ record['data'][0].较上日 }}</td>
                <td>{{ record['data'][0].加油费用 }}</td>
                <td>
                    <button class="layui-btn AlterInfo-btn">修改</button>
                        <a href="{{ url_for('app.delInfo', id=record['data'][0].id) }}" class="layui-btn">删除</a>
                </td>
              </tr>
          {% else %}
              {% for i in range(record['data']|count) %}
                  <tr data-id="{{ record['data'][i].id }}" data-time="{{ record['data'][i].记录时间 }}" data-day="{{ record['data'][i].record_day }}" data-carCode="{{ record['data'][i].car_code }}" data-kilom="{{ record['data'][i].公里数 }}" data-than="{{ record['data'][i].较上日 }}" data-oil="{{ record['data'][i].加油费用 }}">
                  {% if loop.first %}
                        <td rowspan="{{ record['data']|count }}">{{ record['day'] }}</td>
                  {% endif %}
                    <td>{{ record['data'][i].car_code }}</td>
                    <td>{{ record['data'][i].记录时间 }}</td>
                    <td>{{ record['data'][i].公里数 }}</td>
                    <td>{{ record['data'][i].较上日 }}</td>
                    <td>{{ record['data'][i].加油费用 }}</td>
                    <td>
                        <button class="layui-btn AlterInfo-btn">修改</button>
                        <a href="{{ url_for('app.delInfo', id=record['data'][i].id) }}" class="layui-btn">删除</a>
                    </td>
                  </tr>
              {% endfor %}
          {% endif %}

        {% endfor %}

  </tbody>
</table>

<!--信息表的分页-->
<hr>
<div id="Infopage"></div>
</div>

<!--右侧菜单栏-->
    <div class="main_right" style="width: 15%; border: 1px solid black; float: right;margin-top: 50px; padding: 5px;">
        <button type="button" class="layui-btn" id="addinfo">添加信息</button>
    </div>

<!--添加信息的模态框-->
    <div id="addInfoModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.addInfo') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">汽车</label>
            <div class="layui-input-block">
                <select name="car_id" lay-verify="required">
                    <option value=""></option>
                    {% for car in cars %}
                        <option value="{{ car.id }}">{{ car.car_code }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">记录时间</label>
            <div class="layui-input-block">
                <input type="text" name="write_time" id="write_time1" class="layui-input" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">记录日期</label>
            <div class="layui-input-block">
                <input type="text" name="record_day" class="layui-input" id="record_day1" placeholder="默认今天" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">总公里数</label>
        <div class="layui-input-block">
            <input type="number" name="kilom" min="0" class="layui-input" lay-verify="required">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">较上日增加(公里数)</label>
        <div class="layui-input-block">
            <input type="number" name="than_yest" min="0" class="layui-input" lay-verify="required">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">加油费用</label>
        <div class="layui-input-block">
            <input type="number" name="oil_cost" value="0" class="layui-input" lay-verify="required">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    <!--修改信息的模态框-->
    <div id="AlterInfoModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.alterInfo') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">汽车</label>
            <div class="layui-input-block">
                <input type="hidden" name="car_id" id="car_id_info">
                <input type="text" class="layui-input" name="car_code" readonly id="car_code">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">记录时间</label>
            <div class="layui-input-block">
                <input type="text" name="write_time" id="write_time2" class="layui-input" lay-verify="required" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">记录日期</label>
            <div class="layui-input-block">
                <input type="text" name="record_day" id="record_day2" class="layui-input" placeholder="默认今天" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">总公里数</label>
        <div class="layui-input-block">
            <input type="number" name="kilom" id="kilom" min="0" class="layui-input" lay-verify="required">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">较上日增加(公里数)</label>
        <div class="layui-input-block">
            <input type="number" name="than_yest" id="than_yest" min="0" class="layui-input" lay-verify="required">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">加油费用</label>
        <div class="layui-input-block">
            <input type="number" name="oil_cost" id="oil_cost" value="0" class="layui-input" lay-verify="required">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    </div>

    <!--start汽车管理表-->
    <div class="layui-tab-item">
        <!--左侧表格数据栏-->
        <div class="main_lift" style="width: 80%; float: left;">
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>序号</th>
            <th>车辆ID</th>
            <th>车牌号</th>
            <th>车辆类型</th>
            <th rowspan="2">操作</th>
        </tr>
      </thead>
      <tbody>
      {% for car in cars %}
      <tr data-id="{{ car.id }}" data-code="{{ car.car_code }}" data-type="{{ car.car_type }}">
            <td>{{ loop.index }}</td>
            <td>{{ car.id }}</td>
            <td>{{ car.car_code }}</td>
            <td>
                {% if car.car_type==0 %}
                    <label for="" class="">燃油车</label>
                {% else %}
                    <label for="" class="">电车</label>
                {% endif %}
            </td>
            <td>
                <button class="layui-btn AlterCar">修改</button>
                <a href="{{ url_for('app.delCar', id=car.id) }}" class="layui-btn">删除</a>
            </td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
    </div>
    <!--右侧菜单栏-->
    <div class="main_right" style="width: 15%; border: 1px solid black; float: right;margin-top: 50px; padding: 5px;">
<button type="button" class="layui-btn" id="addCar">添加汽车</button>
</div>


<!--模拟添加汽车的模态框-->
<div id="addCarModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.addCar') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">车牌号</label>
            <div class="layui-input-block">
                <input type="text" name="car_code" id="car_code" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
          <select name="car_type" lay-verify="required" id="car_type">
            <option value=""></option>
            <option value="0">燃油车</option>
            <option value="1">电车</option>
          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>
<!--模拟修改汽车的模态框-->
<div id="AlterCarModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.alterCar') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <input type="hidden" name="car_id" id="car_id">
        <div class="layui-form-item">
            <label class="layui-form-label">车牌号</label>
            <div class="layui-input-block">
                <input type="text" name="car_code" id="alterCar_code" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
            <select name="car_type" lay-verify="required" id="alterCar_type">
              <option value=""></option>
                <option value="0">燃油车</option>
                <option value="1">电车</option>

          </select>
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    </div>

    <!--start电度表-->
    <div class="layui-tab-item">
        <!--左侧表格数据栏-->
        <div class="main_lift" style="width: 80%; float: left;">
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>时间</th>
            <th>白夜班</th>
            <th>总电</th>
            <th>小卖部</th>
            <th>充电桩</th>
            <th>记录人</th>
            <th>操作</th>
        </tr>
      </thead>
      <tbody>
      {% for elec in elecs %}
          {% if elec['data']|count==1 %}
              <tr data-id="{{ elec['data'][0].id }}" data-day="{{ elec['day'] }}" data-dayType="{{ elec['data'][0].day_type }}" data-sum_elec="{{ elec['data'][0].sum_elec }}" data-xiaomaibu="{{ elec['data'][0].xiaomaibu }}" data-dianzhuang="{{ elec['data'][0].dianzhuang }}" data-record-man="{{ elec['data'][0].record_man }}">
                <td>{{ elec['day'] }}</td>
                <td>
                    {% if elec['data'][0].day_type==0 %}
                    白班
                    {% else %}
                    夜班
                    {% endif %}
                </td>
                <td>{{ elec['data'][0].sum_elec }}</td>
                <td>{{ elec['data'][0].xiaomaibu }}</td>
                <td>{{ elec['data'][0].dianzhuang }}</td>
                <td>{{ elec['data'][0].record_man }}</td>
                <td>
                    <button class="layui-btn AlterElec-btn">修改</button>
                        <a href="{{ url_for('app.delElecCar',id=elec['data'][0].id) }}" class="layui-btn">删除</a>
                </td>
              </tr>
          {% else %}
              {% for i in range(elec['data']|count) %}
                  <tr data-id="{{ elec['data'][i].id }}" data-day="{{ elec['day'] }}" data-dayType="{{ elec['data'][i].day_type }}" data-sum_elec="{{ elec['data'][i].sum_elec }}" data-xiaomaibu="{{ elec['data'][i].xiaomaibu }}" data-dianzhuang="{{ elec['data'][i].dianzhuang }}" data-record-man="{{ elec['data'][i].record_man }}">
                  {% if loop.first %}
                        <td rowspan="{{ elec['data']|count }}">{{ elec['day'] }}</td>
                  {% endif %}
                    <td>
                        {% if elec['data'][i].day_type==0 %}
                        白班
                        {% else %}
                        夜班
                        {% endif %}
                    </td>
                    <td>{{ elec['data'][i].sum_elec }}</td>
                    <td>{{ elec['data'][i].xiaomaibu }}</td>
                    <td>{{ elec['data'][i].dianzhuang }}</td>
                    <td>{{ elec['data'][i].record_man }}</td>
                    <td>
                        <button class="layui-btn AlterElec-btn">修改</button>
                        <a href="{{ url_for('app.delElecCar',id=elec['data'][i].id) }}" class="layui-btn">删除</a>
                    </td>
                  </tr>
              {% endfor %}
          {% endif %}


      {% endfor %}
      </tbody>
    </table>
    </div>
    <!--右侧菜单栏-->
    <div class="main_right" style="width: 15%; border: 1px solid black; float: right;margin-top: 50px; padding: 5px;">
    <button type="button" class="layui-btn" id="addElecCar">添加记录</button>
    </div>

  <!--模拟添加电度表记录的模态框-->
<div id="addElecCarModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.addElecCar') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">白夜班</label>
            <div class="layui-input-block">
                <select name="day_type" lay-verify="required">
                    <option value=""></option>
                    <option value="0">白班</option>
                    <option value="1">夜班</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
          <input type="text" name="record_day" placeholder="默认今天" class="layui-input" autocomplete="off" id="elec_record_day1">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">总电</label>
        <div class="layui-input-block">
          <input type="number" name="sum_elec" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">小卖部</label>
        <div class="layui-input-block">
          <input type="number" name="xiaomaibu" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">充电桩</label>
        <div class="layui-input-block">
          <input type="number" name="dianzhuang" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">前台记录人</label>
        <div class="layui-input-block">
          <input type="text" name="record_man" lay-verify="required" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    <!--模拟修改电度表记录的模态框-->
<div id="AlterElecCarModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for('app.alterElec') }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">白夜班</label>
            <div class="layui-input-block">
                <select name="day_type" id="day_type" lay-verify="required">
                    <option value=""></option>
                    <option value="0">白班</option>
                    <option value="1">夜班</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
            <input type="hidden" name="elec_id" id="elec_id">
          <input type="text" name="record_day" lay-verify="required" class="layui-input" autocomplete="off" id="elec_record_day2">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">总电</label>
        <div class="layui-input-block">
          <input type="number" name="sum_elec" min="0" lay-verify="required" class="layui-input" id="sum_elec">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">小卖部</label>
        <div class="layui-input-block">
          <input type="number" name="xiaomaibu" min="0" lay-verify="required" class="layui-input" id="xiaomaibu">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">充电桩</label>
        <div class="layui-input-block">
          <input type="number" name="dianzhuang" min="0" lay-verify="required" class="layui-input" id="dianzhuang">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">前台记录人</label>
        <div class="layui-input-block">
          <input type="text" name="record_man" lay-verify="required" class="layui-input" id="record_man">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    </div>

    <!--start发票表-->
    <div class="layui-tab-item">
        <!--左侧表格数据栏-->
        <div class="main_lift" style="width: 80%; float: left;">
    <table class="layui-table" lay-size="sm">
      <colgroup>
        <col width="150">
        <col width="200">
        <col>
      </colgroup>
      <thead>
        <tr>
            <th>日期</th>
            <th>记录时间</th>
            <th>发票号码</th>
            <th>数量</th>
            <th>记录人</th>
            <th>操作</th>
        </tr>
      </thead>
      <tbody>
      {% for invoice in invoices %}
          {% if invoice['data']|count==1 %}
              <tr data-id="{{ invoice['data'][0].id }}" data-day="{{ invoice['day'] }}" data-time="{{ invoice['data'][0].record_time }}" data-code="{{ invoice['data'][0].invoice_code }}" data-coun="{{ invoice['data'][0].coun }}" data-record-man="{{ invoice['data'][0].record_man }}">
                <td>{{ invoice['day'] }}</td>
                <td>{{ invoice['data'][0].record_time }}</td>
                <td>{{ invoice['data'][0].invoice_code }}</td>
                <td>{{ invoice['data'][0].coun }}</td>
                <td>{{ invoice['data'][0].record_man }}</td>
                <td>
                    <button class="layui-btn AlterInvoice-btn">修改</button>
                        <a href="{{ url_for('app.delInvoice', id=invoice['data'][0].id) }}" class="layui-btn">删除</a>
                </td>
              </tr>
          {% else %}
              {% for i in range(invoice['data']|count) %}
                  <tr data-id="{{ invoice['data'][i].id }}" data-day="{{ invoice['day'] }}" data-time="{{ invoice['data'][i].record_time }}" data-code="{{ invoice['data'][i].invoice_code }}" data-coun="{{ invoice['data'][i].coun }}" data-record-man="{{ invoice['data'][i].record_man }}">
                  {% if loop.first %}
                        <td rowspan="{{ invoice['data']|count }}">{{ invoice['day'] }}</td>
                  {% endif %}
                <td>{{ invoice['data'][i].record_time }}</td>
                <td>{{ invoice['data'][i].invoice_code }}</td>
                <td>{{ invoice['data'][i].coun }}</td>
                <td>{{ invoice['data'][i].record_man }}</td>
                    <td>
                        <button class="layui-btn AlterInvoice-btn">修改</button>
                        <a href="{{ url_for('app.delInvoice', id=invoice['data'][i].id) }}" class="layui-btn">删除</a>
                    </td>
                  </tr>
              {% endfor %}
          {% endif %}


      {% endfor %}
      </tbody>
    </table>
    </div>
    <!--右侧菜单栏-->
    <div class="main_right" style="width: 15%; border: 1px solid black; float: right;margin-top: 50px; padding: 5px;">
    <button type="button" class="layui-btn" id="addInvoice">添加发票记录</button>
    </div>

    <!--模拟添加发票记录的模态框-->
    <div id="addInvoiceModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for("app.addInvoice") }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">记录时间</label>
            <div class="layui-input-block">
                <input type="text" name="record_time" id="record_time1" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
          <input type="text" name="record_day" class="layui-input" placeholder="默认今天" autocomplete="off" id="inv_record_day1">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">发票号码</label>
        <div class="layui-input-block">
          <input type="number" name="invoice_code" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">数量</label>
        <div class="layui-input-block">
          <input type="number" name="coun" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">前台记录人</label>
        <div class="layui-input-block">
          <input type="text" name="record_man" lay-verify="required" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>

    <!--模拟修改发票记录的模态框-->
    <div id="alterInvoiceModel" style="display: none; width: 350px; margin-top: 10px;">
    <form class="layui-form" action="{{ url_for("app.alterInvoce") }}" method="post">
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
        <div class="layui-form-item">
            <label class="layui-form-label">记录时间</label>
            <div class="layui-input-block">
                <input type="hidden" name="invoice_id" id="invoice_id">
                <input type="text" name="record_time" id="record_time2" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
          <input type="text" name="record_day" class="layui-input" placeholder="默认今天" autocomplete="off" id="inv_record_day2">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">发票号码</label>
        <div class="layui-input-block">
          <input type="number" name="invoice_code" id="invoice_code" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">数量</label>
        <div class="layui-input-block">
          <input type="number" name="coun" id="coun" min="0" lay-verify="required" class="layui-input">
        </div>
      </div>
        <div class="layui-form-item">
        <label class="layui-form-label">前台记录人</label>
        <div class="layui-input-block">
          <input type="text" name="record_man" id="record_m" lay-verify="required" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
    </form>
</div>


    </div>

    <!--start车辆保养表-->
    <div class="layui-tab-item">内容5</div>
  </div>
</div>
{% endblock %}

{% block lay_js %}
    <script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use(['element','form','layer','laydate','laypage'], function(){
      var element = layui.element;
      var layer = layui.layer;
        var $=layui.$;
        var laydate = layui.laydate;
        var form = layui.form;
        var laypage = layui.laypage;
        form.render();

        laydate.render({
            elem:'#write_time1',
            type:'time'
        });
        laydate.render({
            elem:'#write_time2',
            type:'time'
        });
        laydate.render({
            elem:'#record_time1',
            type:'time'
        });
        laydate.render({
            elem:'#record_time2',
            type:'time'
        });

        laydate.render({
            elem:'#record_day1'
        });
        laydate.render({
            elem:'#record_day2'
        });
        laydate.render({
            elem:'#elec_record_day1'
        });
        laydate.render({
            elem:'#elec_record_day2'
        });
        laydate.render({
            elem:'#inv_record_day1'
        });
        laydate.render({
            elem:'#inv_record_day2'
        });

        form.on('submit(*)', function(data){
          console.log(data);
          //return false;
        });

        //模拟添加记录信息的模态框
        $('button#addinfo').click(function () {
            layer.open({
            type: 1,
            shade: 0,
            title:'添加记录信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#addInfoModel')
          });
        });
        //模拟修改记录信息的模态框
        $('button.AlterInfo-btn').click(function () {
            var self = $(this);
            var tr = self.parent().parent();
            var info_id = tr.attr('data-id');
            var info_day = tr.attr('data-day');
            var car_code = tr.attr('data-carCode');
            var time = tr.attr('data-time');
            var kilom = tr.attr('data-kilom');
            var than = tr.attr('data-than');
            var oil = tr.attr('data-oil');
            document.getElementById('car_code').value=car_code;
            document.getElementById('record_day2').value=info_day;
            document.getElementById('write_time2').value=time;
            document.getElementById('kilom').value=kilom;
            document.getElementById('than_yest').value=than;
            document.getElementById('oil_cost').value=oil;
            document.getElementById('car_id_info').value=info_id;
            layer.open({
            type: 1,
            shade: 0,
            title:'修改记录信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#AlterInfoModel')
          });
        });
        //汽车信息页面的分页
         //总页数大于页码总数

        //模拟添加汽车的弹出框
        $('button#addCar').click(function () {
            layer.open({
            type: 1,
            shade: 0,
            title:'添加汽车',
            skin: 'layui-layer-rim', //加上边框
            area: ['420px', '230px'], //宽高
            content: $('#addCarModel')
          });
        });

        //模拟修改汽车信息的弹出框
        $('.AlterCar').click(function () {
            var self = $(this);
            var tr = self.parent().parent();
            var car_id = tr.attr('data-id');
            var car_code = tr.attr('data-code');
            var car_type = tr.attr('data-type');
            document.getElementById('car_id').value=car_id;
            document.getElementById('alterCar_code').value=car_code;
            //document.getElementById('alterCar_type').value=car_type;
            //$("#alterCar_type").find('option[value="'+car_type+'"]').attr('selected');
            console.log(car_code);
            layer.open({
            type: 1,
            shade: 0,
            title: '修改汽车ID为:',
            skin: 'layui-layer-rim', //加上边框
            area: ['420px', '230px'], //宽高
            content: $('#AlterCarModel')
          });
        });

        //模拟添加电度表信息的模态框
        $('button#addElecCar').click(function () {
            layer.open({
            type: 1,
            shade: 0,
            title:'添加电度表信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#addElecCarModel')
          });
        });

        //模拟修改电度表的模态框
        $('button.AlterElec-btn').click(function () {
            var self = $(this);
            var tr = self.parent().parent();
            var elec_id = tr.attr('data-id');
            var day = tr.attr('data-day');
            var sum_elec = tr.attr('data-sum_elec');
            var xiaomaibu = tr.attr('data-xiaomaibu');
            var dianzhuang = tr.attr('data-dianzhuang');
            var record_man = tr.attr('data-record-man');
            document.getElementById('elec_record_day2').value=day;
            document.getElementById('sum_elec').value=sum_elec;
            document.getElementById('xiaomaibu').value=xiaomaibu;
            document.getElementById('dianzhuang').value=dianzhuang;
            document.getElementById('record_man').value=record_man;
            document.getElementById('elec_id').value=elec_id;
            layer.open({
            type: 1,
            shade: 0,
            title:'修改电度表信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#AlterElecCarModel')
          });
        });

        //添加发票的信息框addInvoice
        $('button#addInvoice').click(function () {
            layer.open({
            type: 1,
            shade: 0,
            title:'添加电度表信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#addInvoiceModel')
          });
        });
        //修改发票的信息框
        $('button.AlterInvoice-btn').click(function () {
            var self = $(this);
            var tr = self.parent().parent();
            var id = tr.attr('data-id');
            var day = tr.attr('data-day');
            var r_time = tr.attr('data-time');
            var code = tr.attr('data-code');
            var coun = tr.attr('data-coun');
            var record_man = tr.attr('data-record-man');
            document.getElementById('record_time2').value=r_time;
            document.getElementById('inv_record_day2').value=day;
            document.getElementById('invoice_code').value=code;
            document.getElementById('coun').value=coun;
            document.getElementById('record_m').value=record_man;
            document.getElementById('invoice_id').value=id;
            layer.open({
            type: 1,
            shade: 0,
            title:'添加电度表信息',
            skin: 'layui-layer-rim', //加上边框
            area: ['520px', '430px'], //宽高
            content: $('#alterInvoiceModel')
          });
        });
    });
</script>

{% endblock %}>

